﻿using System.Web.Mvc;
using System.Web.Security;
using ShopB2C.Helper;
using ShopB2C.Interfaces;


namespace ShopB2C.Controllers.Brower
{
    [Authorize()]
    public partial class CustomerController : BaseController
    {
       
        private static IOrder _orderAccess;
        private static IUser _userAccess;



        public CustomerController()
        {
           
            _orderAccess = DataBaseExecuter.CreateClassByName<IOrder>("OrderAccess");
            _userAccess = DataBaseExecuter.CreateClassByName<IUser>("UserAccess");

        }

        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            this.SiteMapPathAdd("首页" , "/");
            this.SiteMapPathAdd("所有商品" , Url.Action("ProductList" , "Product"));
            this.SiteMapPathAdd("用户中心首页" , Url.Action("Index","Customer"));


            if (!User.Identity.IsAuthenticated)
            {
                HttpContext.Response.Redirect(string.Format("{0}?returnUrl={1}" , FormsAuthentication.LoginUrl , Request.RawUrl));
                Response.End();
            }
        }
        /// <summary>
        /// 管理中心首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }


    }
}
